package com.ram.service.impl;

import com.ram.mapper.AssetMapper;
import com.ram.pojo.Asset;
import com.ram.service.AssetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;

@Service
public class AssetServiceImpl implements AssetService {
    @Autowired
    private AssetMapper assetMapper;

    @Override
    public List<Asset> list() {
        return assetMapper.list();
    }

    @Override
    public Asset getById(Integer id) {
        return assetMapper.getById(id);
    }

    @Override
    public void add(Asset asset) {
        asset.setCreateTime(LocalDateTime.now());
        asset.setUpdateTime(LocalDateTime.now());
        assetMapper.insert(asset);
    }

    @Override
    public void update(Asset asset) {
        asset.setUpdateTime(LocalDateTime.now());
        assetMapper.update(asset);
    }

    @Override
    public void deleteById(Integer id) {
        assetMapper.deleteById(id);
    }
} 